<template>
  <!--详情-->
  <p-drawer
    width="1100"
    :placement="placement"
    :closable="false"
    :visible="visible"
    @close="visible = false"
  >
    <div slot="title">
      开班检验单 <span class="subTitle">检验单号</span><span class="subTitle">{{info.orderNo}}</span>
    </div>
    <div class="content">
      <p-descriptions :column="3">
        <template slot="title">
          <div class="title">基础信息</div>
        </template>
        <p-descriptions-item label="车间"> {{ info.workroomname }} </p-descriptions-item>
        <p-descriptions-item label="班组"> {{ info.classtimename }} </p-descriptions-item>
        <p-descriptions-item label="线体"> {{ info.linename }} </p-descriptions-item>
        <p-descriptions-item label="产品编码"> {{ info.productcode }} </p-descriptions-item>
        <p-descriptions-item label="产品系列"> {{ info.productType }} </p-descriptions-item>
        <p-descriptions-item label="工序工单"> {{ info.processbillno }} </p-descriptions-item>
        <p-descriptions-item label="检验人员"> {{ info.checkUid }} </p-descriptions-item>
        <p-descriptions-item label="检验时间"> {{ moment(info.startDate).format('YYYY-MM-DD HH:mm') }} </p-descriptions-item>
        <p-descriptions-item label="检验模板"> {{ info.templateName }} </p-descriptions-item>
        <!--如系统检验，带出参照生成的检验单号-->
        <p-descriptions-item label="参照单据"> {{ info.linkedNo }} </p-descriptions-item>
        <p-descriptions-item label="检验状态"> {{ info.status == '0' ? '未检验' : '已检验'}} </p-descriptions-item>
        <p-descriptions-item label="检验判定"> {{ info.judgeStatus == '0' ? '合格':'不合格' }} </p-descriptions-item>
      </p-descriptions>
      <p-divider />
      <!--开班检验详情-->
      <classDetail-table
        v-if="info"
        ref="detail"
        :details="info.details"
      ></classDetail-table>
    </div>
    <div class="footer">
      <p-button @click="back">返回</p-button>
    </div>
  </p-drawer>
</template>

<script>
import ClassDetailTable from '../components/ClassDetailTable'
import { getAction } from '@/api/manage'
import moment from 'moment'

export default {
  components: { ClassDetailTable },
  data () {
    return {
      visible: false,
      info: {},
      url: {
        detail: '/mes-manufacture/mfClassTest/'
      }
    }
  },
  computed: {

  },
  methods: {
    moment,
    show (record) {
      this.getDetail(record.id)
      this.visible = true
    },
    getDetail (id) {
      getAction(this.url.detail + id).then(res => {
        if (res.code == 0) {
          this.info = res.data
          if (this.$refs.detail) this.$refs.detail.dataList = this.info.details || []
        }
      })
    },
    back () {
      this.visible = false
    }
  }
}
</script>

<style scoped lang="less">
/deep/ .poros-drawer-body {
  padding-top: 14px;
}
/deep/ .poros-descriptions-row {
  .poros-descriptions-item {
    .poros-descriptions-item-label {
      width: 80px;
    }
  }
}
.subTitle {
  font-weight: normal;
  margin-left: 20px;
  color: #666;
}
.content {
  overflow: auto;
  .title {
    font-size: 14px;
    line-height: 22px;
    padding-left: 13px;
    border-left: 4px solid rgb(64, 100, 223);
  }
}
.footer {
  position: absolute;
  bottom: 30px;
  right: 50px;
}
</style>
